{% load static %}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>顾客信息</title>

    <!--引入依赖项-->
    <link rel="stylesheet" href="{% static 'layui/css/layui.css' %}" media="all">
    <script type="text/javascript" src="{% static 'layui/layui.js' %}"></script>

</head>
<body>
<table class="layui-hide" id="test" lay-filter="test"></table>

<script>
    layui.use('table', function () {
        var table = layui.table;
        var $ = layui.jquery;

        $.ajax({
            url: "{% url 'corp:guests_detail' %}",
            type: 'post',
            data: {
                booking_id:{{ booking_id }},
                csrfmiddlewaretoken: '{{ csrf_token }}'
            },
            dataType: 'json',
            success: function (data) {
                let infos = data.data;

                table.render({
                    elem: '#test',
                    data: infos,
                    cols: [[
                        {type: 'numbers'}
                        , {field: 'id', width: 80, title: 'ID', sort: true}
                        , {field: 'username', width: 120, title: '用户名', sort: true}
                        , {field: 'nickname', width: 120, title: '昵称', sort: true}

                    ]],
                    page: false,
                });
            },
            error: function (data) {
                alert('无法连接后台');
            }
        });


    })
</script>
</body>
</html>